<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var str = 'spring';
        console.log(ren(str));
        function ren(char){
            //字符串转换为数组
            var arr = char.split("");
            //数组反转
            arr.reverse();
            //数组转回字符串
            char = arr.join("");
            return char;
        }

    </script>
</head>
<body>
    
</body>
</html>